class Coupon:
    def __init__(self, threshold, discount):
        self.threshold = threshold
        self.discount = discount

def max_discount_payment(amount, coupons):
    dp = [0] * (amount + 1)
    count = [[0] * len(coupons) for _ in range(amount + 1)]

    for coupon_index, coupon in enumerate(coupons):
        for i in range(amount, coupon.threshold - 1, -1):
            if dp[i - coupon.threshold] + coupon.discount > dp[i]:
                dp[i] = dp[i - coupon.threshold] + coupon.discount
                count[i] = count[i - coupon.threshold][:]  # Copy the previous count
                count[i][coupon_index] += 1

    return dp[amount], count[amount]

# 优惠券信息
coupons = [
    Coupon(299, 2),
    Coupon(499, 3),
    Coupon(999, 5),
    Coupon(1999, 10)
]

# 支付金额
payment_amount = 2160

# 计算最大优惠金额和每张优惠券的使用数量
max_discount, coupon_counts = max_discount_payment(payment_amount, coupons)

print(f"支付 {payment_amount} 元时的最大优惠金额为 {max_discount} 元")
for i, count in enumerate(coupon_counts):
    print(f"优惠券 {i + 1} 使用数量为 {count} 张")
